//C语言不定参函数的使用
#include<stdio.h>
#include<stdarg.h>
#include<stdlib.h>

void printNum(int n,...){
    va_list ls;
    va_start(ls,n);
    for(int i=0;i<n;i++){
        int tmp=va_arg(ls,int);
        printf("%d ",tmp);
    }
    printf("\n");
}
void myprint(const char* fmt,...){
    va_list al;
    char* str;
    va_start(al,fmt);
    int len=vasprintf(&str,fmt,al);
    printf("%s\n",str);
    va_end(al);
    free(str);
}
int main()
{
    printNum(3,111,111,111);
    printNum(2,333,333);

    myprint("%s-%d\n","测试",1);
    myprint("%s-%d\n","测试",2);
    return 0;
}